<?php

class Router{
     
    var $request;   
 
  
    function __construct(){
	echo 'lol';
	$this->request = new Request();
	Route::parse($this->request->url, $this->request );
	echo $this->request->url;
	print_r($this->request);
	//$controller = $this->CallController();
	$name = ucfirst($this->request->controller).'Controller';
	
	spl_autoload_register('CallController');
	spl_autoload_register(function ($class) {
    include 'classes/' . $class . '.class.php';
});
	
    new test();
    call_user_func_array(array($controller, $this->request->action), $this->request->params);
    
	
	
	
	
	
}

function CallController() {
$name = ucfirst($this->request->controller).'Controller';
$file= ROOT.DS.'modules'.DS.$this->request->controller.DS.$name.'.class.php';
require $file;
return new $name($this->request);

}


}
